function [ mpc ] = carMPCconst(sys, x, u, k, param )
ref=param.ref(:,k:k+param.Tp-1);
[m,n]=size(ref);
refCol=ref(1:m*n);
refCol=refCol.';
% refT=zeros(m,n);
% refT(1:m*n)=refCol(1:m*n);
% refT=refT.';
system.A=sys.A;
system.B=sys.B;
system.C=sys.C;
system.D=sys.D;
system.Ts=sys.Ts;
mpc=InitMPC(system,diag(param.diagQ),diag(param.diagR),diag(param.diagH));
mpc=MPCSampling(mpc,param.Tp,param.Tvz,blockMatrix(sys,param.Tvz,param.Block));
mpc=MPCHardBounds(mpc,createBounds(size(system.B,2),param.Tvz,param.lb,param.boundLocation,-1),createBounds(size(system.B,2),param.Tvz,param.ub,param.boundLocation,1));
mpc=MPCSoftBounds(mpc,createBounds(size(system.A,2),param.Tp,param.lb_w,[],-1),createBounds(size(system.A,2),param.Tp,param.ub_w,[],1),selectSoftBounds(length(sys.A),param.Tp,param.kroky,param.promenne));
mpc=addMPCstate(mpc,x);
mpc=addMPCcontrol(mpc,u);
mpc=addMPCref(mpc,refCol);
end